<template>
  <div class="logo-container flex-center">
    <a href="/" class="logo-link">
      <div class="logo-icon">
        <svg viewBox="0 0 24 24" class="logo-svg">
          <path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"/>
        </svg>
      </div>
      <h1 class="title" v-if="!collapse">
        {{ getEnvByName('VITE_APP_TITLE') }}
      </h1>
    </a>
  </div>
</template>

<script lang="ts">
import { defineComponent, computed, ref } from 'vue'
import { useSettingsStore } from '@/store/modules/settings'
import { getEnvByName } from '@/utils/getEnv'
import logoPngUrl from '@/assets/images/logo.png'
export default defineComponent({
  methods: { getEnvByName },
  setup() {
    const settingsStore = useSettingsStore()
    const collapse = computed(() => settingsStore.collapse)
    const logoPng = ref(logoPngUrl)
    return { logoPng, collapse }
  },
})
</script>

<style scoped lang="scss">
.logo-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 60px;
  overflow: hidden;
  background: transparent;
  padding: 0 16px;

  .logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: all 0.3s ease;

    &:hover {
      transform: translateY(-2px);
      
      .logo-icon {
        transform: rotate(5deg) scale(1.1);
      }
      
      .title {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
      }
    }
  }

  .logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);

    .logo-svg {
      width: 24px;
      height: 24px;
      color: white;
    }
  }

  .title {
    display: inline-block;
    margin-left: 12px;
    font-family: 'Poppins', 'Helvetica Neue', Arial, Helvetica, sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    vertical-align: middle;
    transition: all 0.3s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }
    display: inline-block;
    width: 32px;
    height: 32px;
    vertical-align: middle;
    border-radius: 50%;
  }
</style>
